package com.yu.controller;

import com.yu.domain.Msg;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description: TODO
 * @Author : yu
 * Date : 4/21/2020 1:23 PM
 */
@Controller
public class RouterController {

//    @GetMapping({"/","/index"})
//    public String index(){
//        return "index";
//    }
//
//    @RequestMapping("/toLogin")
//    public String toLogin(){
//        return "views/login";
//    }
////    @PostMapping("/login")
////    public String login(){
////
////    }
//
//    @RequestMapping("/level1/{id}")
//    public String level1(@PathVariable("id") int id){
//        return "views/level1/"+id;
//    }
//    @RequestMapping("/level2/{id}")
//    public String level2(@PathVariable("id") int id){
//        return "views/level2/"+id;
//    }
//    @RequestMapping("/level3/{id}")
//    public String level3(@PathVariable("id") int id){
//        return "views/level3/"+id;
//    }
@RequestMapping("/")
public String index(Model model){
    Msg msg =  new Msg("测试标题","测试内容","欢迎来到HOME页面,您拥有 ROLE_HOME 权限");
    model.addAttribute("msg", msg);
    return "home";
}

    @RequestMapping("/toLogin")
    public  String login(){
        return "login";
    }

    @RequestMapping("/admin")
    @ResponseBody
    public String hello(){
        return "hello admin";
    }
}
